package com.tsxy.mall.controller;


import com.tsxy.mall.entity.Book;
import com.tsxy.mall.service.BookService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;

@Controller
public class BookController {
    @Resource
    private BookService bookService;

    @GetMapping("/search")
    public String toSearch(){

        return "search";
    }

    @GetMapping("/book")
    public String toBook(Integer id, Model model){
        Book book = bookService.selectById(id);
        model.addAttribute("book",book);
        return "book";
    }

}
